#-*- coding: utf-8 -*-
import random 
import string

#00:00:00.000
# Start 00:00:00.000 / Frame 0, End 00:01:14.960 / Frame 1874
#https://blog.csdn.net/cymbals/article/details/105235448

def time_diff(time_str1, time_str2):
    # 计算两个时间字符串之间的秒数
    return abs(convert_time_string_to_second(time_str1) - convert_time_string_to_second(time_str2))

def convert_time_string_to_second(time_str):
    # 将时间字符串转化成秒数
    seconds = 0
    for i, t in enumerate(time_str.split(":")):
        if t.find(".") <= 0:
            seconds += (60 if i == 1 else 3600) * int(t)
        else:
            seconds += float(t)
    return seconds

def random_char(y):
    return ''.join(random.choice(string.ascii_letters) for x in range(y))


if __name__ == "__main__":
    print(convert_time_string_to_second("01:00:4.9"))
    print(time_diff("00:00:00.000", "00:01:14.960"))

    # 测试数组乱序
    import random
    arr = [1, 2, 67]
    random.shuffle(arr) 
    print(arr)

    print(random_char(6))